#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n, i, j;
    scanf("%d", &n);
    int **arr = (int**)calloc(n, sizeof(int*));
    for (i = 0; i < n; i++)
    {
        arr[i] = (int*)calloc(n, sizeof(int));
        for (j = 0; j < n; j++)
            scanf("%d", &arr[i][j]);
    }
    for (i = 0; i < n; i++)
    {
        for (j = 0; j < i; j++)
        {
            arr[i][j] = arr[i][j] || arr[j][i];
            arr[j][i] = arr[i][j];
        }
    }
    for (i = 0; i < n; i++)
    {
        for (j = 0; j < n; j++)
            printf("%d ", arr[i][j]);
        printf("\n");
    }
    for (i = 0; i < n; i++)
    {
        free(arr[i]);
        arr[i] = NULL;
    }
    free(arr);
    arr = NULL;

    return 0;
}